USE [PeDALS_DEV]
GO

/****** Object:  StoredProcedure [dbo].[PUB_GetProvenanceXREFFilterNamesVariants]    Script Date: 05/03/2010 10:53:11 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[PUB_GetProvenanceXREFFilterNamesVariants]
AS
BEGIN
	TRY
	SET NOCOUNT ON
		SELECT      ProvenanceId, ProvenanceName AS Name
			FROM         dbo.Provenance
			UNION
			SELECT    ProvenanceId, ProvenanceVariantName AS Name
			FROM         dbo.ProvenanceVariant
			WHERE QualifierId = 2	/*Change the QualifierId = # 
			                          To The Value of the Primary Key
			                          for QualifierType of XREF eg. 2*/	
			ORDER BY Name
	END TRY
BEGIN CATCH
      	PRINT 'An error occurred.  Please notify your administrator to check the error database.'
		INSERT INTO [PEDALS_PAC_ERRORS].[dbo].[PAC_ERROR](ErrorNumber, ErrorMessage, CreatedDate)
			VALUES (ERROR_NUMBER(), ERROR_MESSAGE(), GETDATE())
END CATCH

GO


